<%--
  Created by IntelliJ IDEA.
  User: 倪继文
  Date: 2016/11/1
  Time: 10:10
  To change this template use File | Settings | File Templates.
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="utf-8" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>${hospitalName}${systemName}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" type="text/css" href="${ctx}/static/js/bootstrap-3.3.5/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/static/css/index.css">
    <link rel="stylesheet" href="${ctx}/static/js/plugins/metisMenu/metisMenu.css"/>
    <link rel="stylesheet" href="${ctx}/static/js/plugins/layer/skin/layer.css"/>

    <script type="text/javascript" src="${ctx}/static/js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="${ctx}/static/js/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="${ctx}/static/js/bootstrap-3.3.5/bootstrap.min.js"></script>
    <script type="text/javascript" src="${ctx}/static/js/plugins/metisMenu/jquery.metisMenu.min.js"></script>
    <script type="text/javascript" src="${ctx}/static/js/index.js"></script>

    <link rel="stylesheet" type="text/css" href="/static/fonts/font_Icon/iconfont.css">
    <link rel="stylesheet" type="text/css" href="/static/css/chat.css">

    <script type="text/javascript" src="/static/js/common.js"></script>
    <script type="text/javascript" src="/static/js/dlcommon.js"></script>
    <%
        String HBIpath = "";
        response.setHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS");
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Headers", "Content-Type,Authorization");
        Properties pro = new Properties();
        String realpath = request.getRealPath("/WEB-INF/classes");
        try {
            //读取配置文件
            FileInputStream in = new FileInputStream(realpath + "/sysconfig.properties");
            pro.load(in);
        } catch (FileNotFoundException e) {
            out.println(e);
        } catch (IOException e) {
            out.println(e);
        }

        //通过key获取配置文件
        HBIpath = pro.getProperty("HBIURL");

        //byte b[]=title.getBytes("utf-8");
        //title=new String(b);

    %>

    <script>

        $(function () {
            setInterval(function () {
                updateUserOnline();
            }, 1000 * 60 * 1);

            //$.ajaxSettings.async = false;
            $.getJSON("/sysMenu/getMenuByUserId?userId=${userId}", function (data) {
                //createMenu(data)
                createMenu(data, "topmenu", "childmenu", "");
            });

            $.getJSON("/HBI/toHBIday?path=<%=HBIpath%>/view/systemopt/ajax/AjaxValidateRegister.ashx", function (data) {
                if (data.Type == "success") {
                    var day = data.day;
                    if (day != "-99") {
                        $("#hbi").append("<i class='fa fa-close fa-spin'></i> <a href=\"<%=HBIpath%>/enrollment.aspx\" tabindex=\"999\" ><font color=red>当前为:[天数限制版]还有" + data.day + "天过期![点击注册]</a>")
                    }
                } else {
                    $("#hbi").append("<i class='fa fa-close fa-spin'></i> <a href=\"<%=HBIpath%>/enrollment.aspx\" tabindex=\"999\" ><font color=red>未注册[点击注册]</a>")
                }
            });


        });


        function updateUserOnline() {
            $.ajax({
                type: "POST",
                url: "/SysUserOnline/update",
                dataType: "json",
                success: function (data) {
                    if (data.success == true) {
                    }
                    else {
                        alert(data.msg);
                    }
                }
            });
        }

        function click_logout() {
            $.ajax({
                type: "POST",
                url: "/userlogin/logout",
                dataType: "json",
                success: function (data) {
                    if (data.success == true) {
                        window.location.href = data.url;
                    }
                    else {
                        alert(data.msg);
                    }
                }
            });
        }

        function updatePwd() {
            var height = findDimensions_height();
            var width = findDimensions_width();
            layeropen(0.35 * width, height - 300, "密码修改", '/V_SysUserLogin/toupdatePwd')
        }

        function indexdev() {
            window.open("/devindex");
        }

    </script>
</head>
<body>
<!-- nav-top -->
<div class="navbar-static-top">
    <div class="container-fluid">
        <div class="group-left navbar-left">
					<span class="logo">
                        ${hospitalName}
                    </span>
            <span class="systitle">${systemName}</span>
            <%--<span class="logo" style="color:#21c1b4;font-weight:normal;width:140px;" >--%>
            <%--${hospitalName}--%>
            <%--</span>--%>
            <%--<span class="systitle">${systemName}</span>--%>
        </div>

        <div class="group-right navbar-right">

            <div class="avator-wrap" id="hbi"></div>
            <div class="avator-wrap">
                <c:if test="${devMode}">
                    <div class="avator-wrap">
                        <span><a onclick="indexdev()">[开发配置]&nbsp;&nbsp;</a></span>
                    </div>
                </c:if>
                <input type="hidden" name="userId" id="userId" value="${userId}"/>
                <input type="hidden" name="staffname" id="staffname" value="${staffname}"/>
                <span><a onclick="updatePwd()">你好：${staffname}[修改密码]</a></span>
            </div>

            <div class="icon-wrap"> 
                <span style="margin-top:12px;"><a title="退出" class="glyphicon glyphicon-off"
                                                  onclick="click_logout()"></a></span>
            </div>
        </div>
    </div>
    <div class="content-tabs">
        <button class="roll-nav roll-left J_tabLeft"><i class="glyphicon glyphicon-backward"></i>
        </button>
        <nav class="page-tabs J_menuTabs">
            <div class="page-tabs-content">
                <a href="javascript:;" class=" active J_menuTab" data-id="login.html">首页</a>
                <!--<a href="javascript:;" class="active J_menuTab" data-id="login.html">主页示例三 <i class="fa fa-times-circle"></i></a>-->
            </div>
        </nav>
        <button class="roll-nav roll-right J_tabRight"><i class="glyphicon glyphicon-forward"></i>
        </button>
        <div class="btn-group roll-nav roll-right">
            <button class="dropdown J_tabClose" data-toggle="dropdown">操作<span class="caret"></span>
            </button>
            <ul role="menu" class="dropdown-menu dropdown-menu-right">
                <li class="J_tabRefrsh">
                    <a>刷新当前选项卡</a>
                </li>
                <!--<li class="J_tabShowActive"><a>定位当前选项卡</a>
                </li>-->
                <li class="divider"></li>
                <li class="J_tabCloseAll">
                    <a>关闭全部选项卡</a>
                </li>
                <li class="J_tabCloseOther">
                    <a>关闭其他选项卡</a>
                </li>
            </ul>
        </div>

    </div>
</div>
<div class="J_mainContent mainContent" id="content-main">
    <iframe class="J_iframe" scrolling="auto" style="border:none" name="iframe0" width="100%" height="100%"
            src="${userHome}" frameborder="0" data-id="login.html"></iframe>
</div>

<!-- sidebar  一级菜单-->
<nav class="navbar navbar-sidebar">
    <div class="logo">
        <p>Ddata</p>
        <small>雕龙数据</small>
    </div>
    <ul class="nav nav-main" id="topmenu">

    </ul>
</nav>

<!--二级以后菜单-->
<div class="nav-menu" id="nav-menu">
    <nav class="sidebar-nav" id="childmenu">


    </nav>
</div>





</body>
</html>

